Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/cleanup api #10

Merged
merged 6 commits into from
Oct 9, 2024
Merged

fix/cleanup api #10

merged 6 commits into from
Oct 9, 2024

Conversation

mimir-d
Copy link
Contributor

@mimir-d mimir-d commented Oct 8, 2024

  • refactor crate error type
    • add a single error type for most of the api
  • cleanup WriterError; custom writer type
    • remove WriterError because it'll always be a type of io::Error
    • add WriterType::Custom so that we can write a test checking an actual
      error return from an api call (missing before this commit)
  • explicitly present public crate api
  • end methods should consume self
    • this change disallows usage of contextual objects after emitting their
      end artifact, at compile time
  • make create api methods naming consistent
    • some methods had a verb, some didnt; add a verb to all the public api
      methods for consistency

@mimir-d mimir-d requested a review from njordr October 8, 2024 16:55
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.4%. Comparing base (b5f9fe2) to head (71bcce6).
Report is 8 commits behind head on dev.

Additional details and impacted files

Base automatically changed from fix/test_incorrect_asserts to dev October 9, 2024 13:02
- this is public api; consolidate with public config types
- the emitter is not public, so it sits in its own file

Signed-off-by: mimir-d <[email protected]>
- add a single error type for most of the api

Signed-off-by: mimir-d <[email protected]>
- remove WriterError because it'll always be a type of io::Error
- add WriterType::Custom so that we can write a test checking an actual
  error return from an api call (missing before this commit)

Signed-off-by: mimir-d <[email protected]>
- this change disallows usage of contextual objects after emitting their
  end artifact, at compile time
- previously a user could have emitted, for example, a step log after a
  step end

Signed-off-by: mimir-d <[email protected]>
- some methods had a verb, some didnt; add a verb to all the public api
  methods for consistency (also matches the python api more)
- another reason for this is that the verb allows for backward/future
  compat in the api (eg. `add_step` could turn into `start_step`, with the
  semantic of also starting the step, not just creating it; all while
  being able to keep the previous `add_step` name. if the method was
  called just `step`, this wouldnt be possible)

Signed-off-by: mimir-d <[email protected]>
@mimir-d mimir-d merged commit 115c9fe into dev Oct 9, 2024
12 checks passed
@mimir-d mimir-d deleted the fix/cleanup_api branch October 9, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants